package com.zhss.eshop.pay.service.impl;

import com.zhss.eshop.pay.domain.PayTransactionDTO;
import com.zhss.eshop.pay.domain.PayTransactionDO;
import com.zhss.eshop.pay.dao.PayTransactionDAO;
import com.zhss.eshop.pay.service.PayTransactionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import com.zhss.eshop.common.util.ObjectUtils;

/**
 * TODO
 *
 * @since 2021-05-15 16:24:13
 */
@Service
public class PayTransactionServiceImpl implements PayTransactionService {
   
   @Resource
    private PayTransactionDAO payTransactionDAO;

    @Override
    public PayTransactionDTO queryById(Long id) throws Exception {
        return payTransactionDAO.queryById(id).clone(PayTransactionDTO.class);
    }

    @Override
    public List<PayTransactionDTO> queryAllByLimit(int offset, int limit) throws Exception {
        return ObjectUtils.convertList(payTransactionDAO.queryAllByLimit(offset, limit), PayTransactionDTO.class);
    }

    @Override
    public Boolean save(PayTransactionDTO payTransactionDTO) throws Exception {
        payTransactionDAO.save(payTransactionDTO);
        return true;
    }

    @Override
    public Boolean update(PayTransactionDTO payTransactionDTO) throws Exception {
        payTransactionDAO.update(payTransactionDTO);
        return true;
    }

    @Override
    public Boolean deleteById(Long id) throws Exception {
        payTransactionDAO.deleteById(id);
        return true;
    }
}